﻿using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.OAuth;

namespace AuthClientApi.OAuth
{
    public static class SBlogOAuthExtensions
    {
        public const string AuthenticationScheme = "SBlogOAuth";
        public static AuthenticationBuilder AddSBlogOAuth(this AuthenticationBuilder builder)
            => builder.AddQQ(AuthenticationScheme, _ => { });

        public static AuthenticationBuilder AddSBlogOAuth(this AuthenticationBuilder builder, Action<OAuthOptions> configureOptions)
            => builder.AddQQ(AuthenticationScheme, configureOptions);

        public static AuthenticationBuilder AddQQ(this AuthenticationBuilder builder, string authenticationScheme, Action<OAuthOptions> configureOptions)
            => builder.AddQQ(authenticationScheme, "SBlogOAuth", configureOptions);

        public static AuthenticationBuilder AddQQ(this AuthenticationBuilder builder, string authenticationScheme, string displayName, Action<OAuthOptions> configureOptions)
            => builder.AddOAuth<SBlogOAuthOptions, SBlogOAuthHandler>(authenticationScheme, displayName, configureOptions);
    }
}
